package com.example.demo.service;
import com.example.demo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public void createUser(String username, String password) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(16);

        String result = encoder.encode(password);
// 数据库插入逻辑
        userMapper.insertUser(username, result);
    }
}
